package online.foxnull2.foxmall.member.web;

import com.alibaba.fastjson.JSON;
import online.foxnull2.common.utils.R;
import online.foxnull2.foxmall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Controller
public class MemberWebController {

    private final OrderFeignService orderFeignService;

    @Autowired
    public MemberWebController(OrderFeignService orderFeignService) {
        this.orderFeignService = orderFeignService;
    }

    @GetMapping("/member/order/list.html")
    public String list(@RequestParam Map<String, Object> params, Model model) {
        R r = orderFeignService.listWithItem(params);
        model.addAttribute("r", r);
        System.out.println(JSON.toJSONString(r));
        return "list";
    }
}
